<script>


window.onload = function(){

	callpay();
}
//调用微信JS api 支付
	function jsApiCall()
	{

		WeixinJSBridge.invoke(
			'getBrandWCPayRequest',
			<?php echo $payinfo; ?>,
			function(res){
				WeixinJSBridge.log(res.err_msg);
				
				if(3 == res.err_code || res.err_msg == "get_brand_wcpay_request:cancel"){

          document.getElementById("button").innerText = "立即支付";
					//alert('支付失败');
					//window.location.href="<?php echo $orderinfo['fail_url']; ?>";
					
				}else if(res.err_msg == "get_brand_wcpay_request:ok"){
						
					window.location.href="<?php echo $orderinfo['success_url']; ?>";
				}else{
          alert(res.err_msg);
        }
			}
		);
	}

	function callpay()
	{	
    //
		if (typeof WeixinJSBridge == "undefined"){
		    if( document.addEventListener ){
		        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
		    }else if (document.attachEvent){
		        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
		        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
		    }
		}else{
		    jsApiCall();
		}
	}

  function clickpay(){
    document.getElementById("button").innerText = "加载中...";
    callpay();
  }
	
	</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<title>微信支付</title>
<style>
    .weui-wepay-code-wrap{
  background-color: #fbf9fe;
}
.weui-wepay-code{
    margin: 15px;
}
.weui-wepay-code__bd{
    background-color: #23ac38;
    padding: 32px 0 48px 0;
    text-align: center;
}
.weui-wepay-code__ft{
    background-color: #fff;
}
.weui-wepay-code__info{
    font-weight: bold;
    font-size: 25px;
    color: #fff;
}
.weui-wepay-code__title{
    font-weight: bold;
    font-size: 35px;
    color: #fff;
}
.weui-wepay-code__main{
    padding: 12px 13px;
    background-color: #ffffff;
    width: 155px;
    margin: 13px auto 0;
    box-sizing: border-box; 
    line-height: 1;
}
.weui-wepay-code__subtitle{
    font-weight: bold;
    color: #000;
    font-size: 14px;
    margin-top: 8px;
}

.weui-wepay-code_logo{
    border-radius: 20px;
    overflow: hidden;
}
.weui-wepay-code__business{
    padding: 20px 0;
}
.weui-wepay-code__business-logo{
    line-height: 1;
    text-align: center;
}
.weui-wepay-code__business-info{
    text-align: center;
    margin-top: 6px;
    font-size: 12px;
    color: #000000;
}

.weui-wepay-pay-wrap{
  background-color: #fbf9fe;
}
.weui-msg{
  position: relative;
  z-index: 1;
}
.weui-wepay-pay {
  position: relative;
  z-index: 1;
  padding: 15px;
}
.weui-wepay-pay__inner {
  background-color: #FFFFFF;
  padding: 16px;
  position: relative;
  z-index: 0;
}
.weui-wepay-pay__inner:after {
  content: " ";
  width: 200%;
  height: 200%;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid #DDDDDD;
  transform: scale(0.5);
  transform-origin: 0 0;
  box-sizing: border-box;
}
.weui-wepay-pay__title {
  font-size: 12px;
  color: #333333;
  font-weight: normal;
}
.weui-wepay-pay__inputs {
  margin-top: 12px;
  padding-bottom: 18px;
  position: relative;
  z-index: 2;
  color: #333333;
}
.weui-wepay-pay__inputs:after {
  content: " ";
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  height: 1px;
  border-bottom: 1px solid #DDDDDD;
  color: #DDDDDD;
  transform-origin: 0 100%;
  transform: scaleY(0.5);
}
.weui-wepay-pay__strong {
  position: absolute;
  color: #000000;
  font-size: 28px;
  line-height: 1;
  left: -6px;
  top: -3px;
  font-weight: normal;
}
.weui-wepay-pay__input {
  padding-left: 28px;
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: 0;
  height: 40px;
  line-height: 40px;
  font-size: 40px;
}
.weui-wepay-pay__input::-webkit-textfield-decoration-container {
  background-color: transparent;
}
.weui-wepay-pay__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.weui-wepay-pay__input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}
.weui-wepay-pay__input::-webkit-input-placeholder {
  color: #EEEEEE;
}
.weui-wepay-pay__intro {
  font-size: 12px;
  color: #9e9e9e;
  margin-top: 14px;
}
.weui-wepay-pay__info {
  font-size: 12px;
  color: #9e9e9e;
  margin-top: 16px;
  text-align: center;
}
.weui-wepay-pay__btn {
  margin-top: 12px;
}
.weui-wepay-logo-default{
  font-size: 16px;
}
.weui-wepay-logos_ft {
    position: fixed;
    background-color: transparent;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 0;
}
.weui-btn:after {
    content: " ";
    width: 200%;
    height: 200%;
    position: absolute;
    top: 0;
    left: 0;
    border: 1px solid rgba(0,0,0,.2);
    -webkit-transform: scale(.5);
    transform: scale(.5);
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    box-sizing: border-box;
    border-radius: 10px;
}
.weui-btn {
    position: relative;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding-left: 14px;
    padding-right: 14px;
    box-sizing: border-box;
    font-size: 18px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    line-height: 2.55555556;
    border-radius: 5px;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
.weui-btn_primary {
    background-color: #1aad19;
}
.weui-loading{width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:weuiLoading 1s steps(12,end) infinite;animation:weuiLoading 1s steps(12,end) infinite;background:transparent url() no-repeat;background-size:100%}
@-webkit-keyframes weuiLoading{0%{-webkit-transform:rotate3d(0,0,1,0deg)}
100%{-webkit-transform:rotate3d(0,0,1,360deg)}
}
@keyframes weuiLoading{0%{transform:rotate3d(0,0,1,0deg)}
100%{transform:rotate3d(0,0,1,360deg)}
}
</style>
</head>
<body ontouchstart class="weui-wepay-pay-wrap">

<div class="weui-wepay-pay">
    <div class="weui-wepay-code weui-wepay-code_logo">
    <div class="weui-wepay-code__bd">
        <p class="weui-wepay-code__logo">
            
            <img src="https://act.weixin.qq.com/static/cdn/img/wepayui/0.1.1/wepay_logo_default_white_500x126.png" alt="" width="190" height="48">
        </p>
    </div>
    <div class="weui-wepay-code__ft">
        <div class="weui-wepay-code__business">
            <div class="weui-wepay-code__business-logo">
                <!-- <img src="img/logo_servives.jpg" alt="" width="200" height="28"> -->
                <img src="https://act.weixin.qq.com/static/cdn/img/wepayui/0.1.1/wepay_logo_default_extend_green.svg" alt="" width="121" height="40">
            </div>
            <p class="weui-wepay-code__business-info">提供支持服务</p>
        </div>
    </div>
</div>
    <div class="weui-wepay-pay__ft">
        <p class="weui-wepay-pay__info">如不能支付，请点击下方按钮进行支付</p>
        <div class="weui-wepay-pay__btn">
            <!-- <a href="javascript:;"  class="weui-btn weui-btn_primary">立即支付</a> -->

            <a href="javascript:;" id="button" onclick="clickpay();" class="weui-btn weui-btn_primary weui-btn_loading"><i class="weui-loading"></i>加载中...</a>
        </div>
    </div>
</div>
<div class="weui-wepay-logos weui-wepay-logos_ft">
    <img src="https://act.weixin.qq.com/static/cdn/img/wepayui/0.1.1/wepay_logo_default_gray.svg" alt="" height="16">
</div>
</body>
</html>

